#pragma once
#include <string>

namespace Util {

template <typename T, typename = std::enable_if_t<!std::is_same<T, std::string>::value>> std::string __to_string(const T& value)
{
    std::ostringstream oss;
    oss << value;
    return oss.str();
}
std::string __to_string(const std::string& value) { return value; }

template <typename... Args> std::string errparam(Args&&... args)
{
    std::string ret = "#{\"fixed_key\":[";
    std::vector<std::string> params;
    // 展开参数包，并将每个参数转换为std::string
    (params.emplace_back(__to_string(std::forward<Args>(args))), ...);

    for (size_t i = 0; i < params.size(); i++)
    {
        if (i == params.size() - 1)
            ret += "\"" + params[i] + "\"";
        else
            ret += "\"" + params[i] + "\",";
    }
    ret += "]}";
    return ret;
}

}  // namespace Util
